package com.uwantsoft.util;

/**
 * @author LeiPeichen.
 */
public abstract class ParkCodeGenerator {

    private static final int ZERO_TOTAL_AMOUNT = 4;

    public static String generate(String city,int amount) {
        amount = amount + 1;
        int amountLength = String.valueOf(amount).length();
        int zeroAmount = ZERO_TOTAL_AMOUNT - amountLength;
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(city);
        stringBuilder.append(JodaUtils.formatDateTime(JodaUtils.now(), JodaUtils.YYYY_MM_DD).replace("-",""));
        for(int i = 0;i<zeroAmount;i++){
            stringBuilder.append("0");
        }
        stringBuilder.append(amount);
        return stringBuilder.toString();
    }
}
